<?php
/**
* @version $Id: admin.admin.html.php 7211 2007-04-29 02:26:51Z robs $
* @package Joomla
* @subpackage Admin
* @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* Joomla! is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*/

// no direct access
defined( '_VALID_MOS' ) or die( 'Restricted access' );

	// lock it down to only Super Administrators...
	if ( $my->usertype != "Super Administrator" ) {
		mosRedirect( 'index2.php', _NOT_AUTH );
	}
		if (file_exists( '../includes/version.php' )) {
			$isV46 = "1";
		}

?>
    <script type="text/javascript">
      (function() {
        var body = document.body,
        global = this,
        element, textNode;

        if (body && body.insertBefore && body.removeChild && document.createElement
          && document.createTextNode && (element = document.createElement('div'))
          && element.appendChild
          && (textNode = document.createTextNode('Mambo Tools Suite Is Processing Your Request. This may take awhile...  '))) {
          element.className = 'loading';
          element.appendChild(textNode);
          body.insertBefore(element, body.firstChild);
        }

        global.onload = function() {
        body.removeChild(element);
        global.onload = null;
        };
      })();
</script>


<style>
	#jts-container { font-family: arial, helvetica, verdana; font-size: 11px; }
	#jts-container td.jts-heading { min-height: 60px; width: 110px; text-align: left; font-size: 12px;  background-image: url(components/com_mts/images/mts.gif); background-position: 1px 1px; background-repeat: no-repeat; }
	#jts-container h3 { font-size: 15px; font-weight: bold; color: #0066cc; padding: 10px 10px 4px 0px; text-align: left; border-bottom: 1px solid #0066cc; margin-bottom: 10px; }

/* Messages */
	div.msg-info   { border: 1px solid #008080; border-left: 12px solid #008080; background-color: #ffffff; width: 150px; max-width: 150px; min-height: 50px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/info_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-advise { border: 1px solid #4B0082; border-left: 12px solid #4B0082; background-color: #e6e6fa; width: 150px; max-width: 150px; min-height: 50px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/advisor_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-good   { border: 1px solid #32A500; border-left: 12px solid #32A500; background-color: #f0f8ff; width: 150px; max-width: 150px; min-height: 50px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/good_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-warn   { border: 1px solid #F57900; border-left: 12px solid #F57900; background-color: #fffacd; width: 150px; max-width: 150px; min-height: 50px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/warn_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-error  { border: 1px solid #DC143C; border-left: 12px solid #DC143C; background-color: #FFFF00; width: 150px; max-width: 150px; min-height: 50px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/error_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-info-scale   { border: 1px solid #008080; border-left: 12px solid #008080; background-color: #ffffff; width: 90%; min-height: 30px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/info_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-advise-scale { border: 1px solid #4B0082; border-left: 12px solid #4B0082; background-color: #e6e6fa; width: 90%; min-height: 30px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/advisor_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-good-scale   { border: 1px solid #32A500; border-left: 12px solid #32A500; background-color: #f0f8ff; width: 90%; min-height: 30px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/good_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-warn-scale   { border: 1px solid #F57900; border-left: 12px solid #F57900; background-color: #fffacd; width: 90%; min-height: 30px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/warn_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.msg-error-scale  { border: 1px solid #DC143C; border-left: 12px solid #DC143C; background-color: #FFFF00; width: 90%; min-height: 30px; padding: 3px; padding-top: 20px; margin: 5px; background-image: url(components/com_mts/images/error_icon_20px.png); background-position: 1px 1px; background-repeat: no-repeat; }
	div.notice-heading  { font-size: 14px; font-weight: bold; border-bottom: 1px solid #000000; margin-top: 5px; margin-bottom: 15px;}
	.right-col   { border: 1px solid #e6e6fa; background-color: #f5f5f5; }
	.left-col    { border: 1px solid #e6e6fa; background-color: #f5f5f5; }

/* Installation Assessment Scale */
	.data-container { border: 1px solid #e6e6fa; background-color: #f0ffff; }
	.side  { font-size: 8px; width: 35px; }
	.scale { font-size: 8px; border: 1px solid #dedede; width: 20px; }
	.rate  { font-size: 12px; text-align: center; font-weight: bold; color: #404040; border: 1px solid #e6e6fa;}
	.title { font-size: 12px; text-align: center; font-weight: bold; color: #404040; padding: 5px; }
	.scaleMsg { font-size: 10px; text-align:left; font-weight: normal; color: #808080; padding: 5px; }
	.installCheckMsg { font-size: 12px; text-align:left; font-weight: normal; color: #808080; padding: 5px; }

/* Assistance/Help Page */	
	blockquote { width: 500px; padding: 10px 10px 10px 80px; margin: 15px 0; background: #F3F3F3 url(images/blockquote.png) 0 0 no-repeat; border-bottom: 1px solid #C0C0C0; }
    .help h1 { font-size: 15px; font-weight: bold; color: #0066cc; padding: 10px 10px 4px 0px; text-align: left; border-bottom: 1px solid #0066cc; margin-bottom: 10px; }

    .loading { 
      background: #FF9900;
      color: #000000;
      font: 100% sans-serif;
      padding: 0.2em 0.2em;
/*      position: relative; */
      position: absolute; 
	  left: 0.5em;
      right: 0.5em;
/*      right: 0.5em;  */
      top: 0em;
/*      width: 95%; */
      text-align: center;
      padding-left: 25px;
      padding-right: 25px;
	  /*      
	  background-image: url(images/users.png);
      background-repeat: no-repeat;
	  */
    }

<?php
	if ($isV15 = "1") {
	  echo "th { text-align: center; background: #f0f0f0; color: #666; border-bottom: 1px solid #999; border-left: 1px solid #fff; }";
	}

?>

</style>


		<table id="jts-container" align="left" border="0" width="100%">
		<tr>
			<td class="jts-heading" rowspan="4" width="100">&nbsp;</td>
		<?php
		$jtsquery = "SELECT * FROM ".$mosConfig_dbprefix."mts";
		$jtsresult = mysql_query ($jtsquery);
		while ( $jtsrun = mysql_fetch_array($jtsresult) )
		{
			echo "<td width='85' nowrap>Last Run:</td><td class='left-col' width='300' nowrap> &nbsp; ".$jtsrun['lastrun']."</td>";
			echo "<td rowspan='4' align='right' valign='top'>";
			
			echo "<table cellpadding='0' cellspacing='0' align='right' class='right-col' style='margin-right: 30px;'>";
		    echo "<tr><td colspan='5' valign='top'><b>Message Colour and Icon Key:</b></td></tr><tr>";
		    echo "<td valign='top'><div class='msg-info' style='min-height: 10px; max-height: 20px; height: 15px; width: 55px; font-size: 8px;'>Information</div></td>";
			echo "<td valign='top'><div class='msg-advise' style='min-height: 10px; max-height: 20px; height: 15px; width: 55px; font-size: 8px;'>Advisory</div></td>";
			echo "<td valign='top'><div class='msg-good' style='min-height: 10px; max-height: 20px; height: 15px; width: 55px; font-size: 8px;'>Success</div></td>";
			echo "<td valign='top'><div class='msg-warn' style='min-height: 10px; max-height: 20px; height: 15px; width: 55px; font-size: 8px;'>Warning</div></td>";
			echo "<td valign='top'><div class='msg-error' style='min-height: 10px; max-height: 20px; height: 15px; width: 55px; font-size: 8px;'>Critical</div></td>";
		    echo "</tr><tr><td colspan='5' style='padding-top: 5px;'><b>Security Icon Key:</b></td></tr><tr>";
			echo "<td style='font-size: 8px; padding: 5px;' valign='bottom'><img src='images/apply_f2.png' height='26' width='26' align='left'>Best<br />Practice</td>";
			echo "<td style='font-size: 8px; padding: 5px;' valign='bottom'><img src='images/cancel.png' height='26' width='26' align='left'>Risk<br />Potential</td>";
			echo "<td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td>";
		    echo "</tr></table>";

			echo "</td></tr>";
			echo "<tr><td>Last Rating:</td><td class='left-col'> &nbsp;".$jtsrun['lastrate']." %</td></tr>";
		    echo "<tr><td><b>MTS Version:<br />Report Date:</b></td><td class='left-col'> &nbsp; ".$jtsrun['jtsver']."<br/> &nbsp; ". date('l dS \of F Y \@ H:i:s') ."</td></tr>";
			echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
		}
		?>

		</table>



		<br clear="all" /><br />

<?php



class HTML_admin_misc {

	/**
	* Control panel
	*/
	function controlPanel() {
		global $mosConfig_absolute_path, $mainframe;
		?>
		<table class="adminheading" border="0">
		<tr>
			<th class="cpanel">
			Control Panel
			</th>
		</tr>
		</table>
		<?php
		$path = $mosConfig_absolute_path . '/administrator/templates/' . $mainframe->getTemplate() . '/cpanel.php';
		if (file_exists( $path )) {
			require $path;
		} else {
			echo '<br />';
			mosLoadAdminModules( 'cpanel', 1 );
		}
	}

	function get_php_setting($val, $colour=0, $yn=1) {
		$r =  (ini_get($val) == '1' ? 1 : 0);

		if ($colour) {
			if ($yn) {
				$r = $r ? '<span style="color: green;">ON</span>' : '<span style="color: red;">OFF</span>';
			} else {
				$r = $r ? '<span style="color: red;">ON</span>' : '<span style="color: green;">OFF</span>';
			}

			return $r;
		} else {
			return $r ? 'ON' : 'OFF';
		}
	}

	function get_server_software() {
		if (isset($_SERVER['SERVER_SOFTWARE'])) {
			return $_SERVER['SERVER_SOFTWARE'];
		} else if (($sf = phpversion() <= '4.2.1' ? getenv('SERVER_SOFTWARE') : $_SERVER['SERVER_SOFTWARE'])) {
			return $sf;
		} else {
			return 'n/a';
		}
	}





		function system_info( $version, $option ) { include("components/". $option ."/hisa.mts.php"); }

		function showDIA( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;
			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsdia");
				$tabs->startTab("File Integrity","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>Core Distribution Diagnostic</th>";
				echo "</tr>";
				echo "</table>";
			include("components/". $option ."/dia.mts.php"); 
		}

		function showDPA( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;
			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsdpa");
				$tabs->startTab("Directories","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>Directory Permissions Audit</th>";
				echo "</tr>";
				echo "</table>";
			include("components/". $option ."/dpa.mts.php"); 
		}

		function showFPA( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;
			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsfpa");
				$tabs->startTab("Files","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>File Permissions Audit <span style='font-weight: normal;'><i>(Excludes Files over 5MB)</i></span></th>";
				echo "</tr>";
				echo "</table>";
			include("components/". $option ."/fpa.mts.php"); 
		}

		function showICO( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;
			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsico");
				$tabs->startTab("Components","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>Installed Components Audit</th>";
				echo "</tr>";
				echo "</table>";
			include("components/". $option ."/ico.mts.php"); 
		}

		function showIMO( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;
			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsimo");
				$tabs->startTab("Modules","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>Installed Modules Audit</th>";
				echo "</tr>";
				echo "</table>";
			include("components/". $option ."/imo.mts.php"); 
		}

		function showIMA( $version, $option ) { 
			global $mosConfig_absolute_path, $mosConfig_live_site, $mosConfig_sitename, $database, $mosConfig_caching, $mosConfig_cachepath, $mainframe, $mosConfig_dbprefix, $mosConfig_sef, $mosConfig_db, $mosConfig_lifetime, $mosConfig_debug, $mosConfig_host, $mosConfig_offline, $mosConfig_debug_db, $mosConfig_debug_lang, $mosconfig_cache_handler, $mosConfig_sef_rewrite;

			if (file_exists( '../includes/version.php' )) {
				$isV10 = "1";
			} else {
				$isV15 = "1";
			}

			$width 	= 400;	// width of 100%
			$tabs 	= new mosTabs(0);
				$tabs->startPane("mtsima");
				$tabs->startTab("Mambots","system-page");
				echo "<nobr clear='all'>";
				echo "<table border='0' cellspacing='2' cellpadding='2' id='jts-container' class='adminform'>";
				echo "<tr>";
				echo "<th colspan='3'>Installed Mambots Audit</th>";
				echo "</tr>";
				echo "</table>";

			include("components/". $option ."/ima.mts.php"); 
		}

		function showDBO( $version, $option ) { include("components/". $option ."/dbo.mts.php"); }

		function showAbout( $version, $option ) { include("components/". $option ."/about.mts.php"); }
	}

?>